package com.mifengs.mall.ui.share;

import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.mifengs.mall.R;
import com.mifengs.commonbase.base.BaseActivity;
import com.mifengs.mall.ui.my.RedPacketFragment;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.ogaclejapan.smarttablayout.utils.v4.Bundler;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 *
 * 分享赚钱页面
 */
public class ShareToMoneyActivity extends BaseActivity {


    @BindView(R.id.smartTabLayout_msg)
    SmartTabLayout mViewPagerTab;

    @BindView(R.id.viewpager)
    ViewPager mViewpager;

    private String[] str = new String[]{"日排名", "周排名","月排名"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_share_to_money);
        ButterKnife.bind(this);
        setStatusColorAndMode(R.color.white,true);
        init();
    }

    private void init() {
        FragmentPagerItems pages = new FragmentPagerItems(this);
        for(int i=0;i<str.length;i++){
            int type = 0;
            switch (i){
                case 0:
                    type = 0;
                    break;
                case 1:
                    type = 2;
                    break;
                case 2:
                    type = 3;
                    break;
            }
            pages.add(FragmentPagerItem.of(str[i],RankingFragment.class,new Bundler().putInt("type",type).get()));
        }
        FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
                getSupportFragmentManager(), pages);

        mViewpager.setAdapter(adapter);
        mViewpager.setCurrentItem(0);
        mViewpager.setOffscreenPageLimit(2);
        mViewPagerTab.setViewPager(mViewpager);
    }


}
